﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Transformer.iHunter.UI
{
    public partial class HtmlMessageEditor : HtmlMessageEditorBase
    {
        private string msgInvalidReason = "";

        public HtmlMessageEditor()
        {
            InitializeComponent();
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
        }

        protected override string[] GetFields()
        {
            return new string[] {"Receiver", "Title"};
        }

        public override bool MessageValid
        {
            get {
                FieldTextBox txtBox = txtBoxes["Receiver"];
                if (null == txtBox.Text || txtBox.Text.Trim().Length == 0)
                {
                    msgInvalidReason = "Receiver can not be empty";
                    ShowMessageInvalidReason("Receiver", msgInvalidReason);
                    
                    return false;
                }

                txtBox = txtBoxes["Title"];
                if (null == txtBox.Text || txtBox.Text.Length == 0)
                {
                    msgInvalidReason = "Title can not be empty";
                    ShowMessageInvalidReason("Title", msgInvalidReason);
                    return false;
                }

                return true;
            }
        }

        protected override string[] ReadonlyFieldsOnReply()
        {
            return new string[] { "Receiver" };
        }
    }
}
